package com.manpower.ui;

import java.util.ArrayList;
import java.util.List;

import com.manpower.adapter.RegionalStatisticalAdapter;
import com.manpower.data.RegionalStatisticalData;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class RegionalStatisticalActivity extends AnotherBaseActivity{
	
	private ListView mList;
	private ArrayList<RegionalStatisticalData> mDatas;
	private RegionalStatisticalAdapter mAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_label_regional_statistical);
		initiate();
		updateView();
	}

	private void initiate() {
//		txtTitle.setText(R.string.label_regional_statistical);
		mDatas = new ArrayList<RegionalStatisticalData>();
		mList = (ListView)findViewById(R.id.list);
		mAdapter = new RegionalStatisticalAdapter(this, mDatas);
		mList.setAdapter(mAdapter);
		mList.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Intent intent = new Intent(RegionalStatisticalActivity.this, StasticDetailActivity.class);
				startActivity(intent);
			}
			
		});
	}
	
	private void updateView() {
		for(int i = 0; i< 10; i++) {
			RegionalStatisticalData data = new RegionalStatisticalData();
			data.setmTitle("银龙小区第一居");
			data.setmDetail("银龙小区第一居");
			mDatas.add(data);
			mAdapter.notifyDataSetChanged();
		}
	}
}
